forward algorithm, solves the system where L is a lower triangular matrix and b is a vector
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=dp), | intent(in), | DIMENSION(:, :) | :: | L | ||
real(kind=dp), | intent(in), | DIMENSION(:) | :: | b |
FUNCTION forward(L, b) RESULT(y) REAL(dp), DIMENSION(:, :), INTENT(IN) :: L REAL(dp), DIMENSION(:), INTENT(IN) :: b REAL(dp), DIMENSION(SIZE(L, 1)) :: y INTEGER :: i, N N = SIZE(L, 1) y(1) = b(1) / L(1, 1) DO i = 2,N y(i) = (b(i) - DOT_PRODUCT(L(i,1:i-1), y(1:i-1))) / L(i,i) END DO END FUNCTION forward